package com.mcms.service.dw;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.ralasafe.user.User;

import com.mcms.service.common.DealResult;
import com.mcms.web.vo.DWZResult;

public class AddCustomService {

	public static void execute(HttpServletRequest request){
		
		boolean isSuc = true;
		
		String uuid = request.getParameter("customId");
		String isSubscribeDoctor = request.getParameter("is_subscribe_doctor")==null?"1":request.getParameter("is_subscribe_doctor");
		
		//插入用户基本信息
		isSuc = new AddCustomBasicInfoService().execute(request, uuid);
		
		//插入问诊信息
		isSuc = new AddCustomInquiryInfoService().execute(request, uuid);
		
		if("0".equals(isSubscribeDoctor) || isSubscribeDoctor == "0"){//预约就诊
			isSuc = new AddSubscribeDoctorInfoService().execute(request, uuid);
//			isSuc = isSuc || addSubscribeDoctorInfo(request,uuid);
		}
		
		//处理结果
		request.setAttribute("tabId", "page");
		DealResult.execute(request,isSuc);
	}
	
	public static void dealResult(HttpServletRequest request,boolean isSuc){
		DWZResult dwzResult = new DWZResult();//"message":"操作成功", "navTabId":"navNewsLi", "forwardUrl":"", "callbackType":"closeCurrent"}
		dwzResult.setNavTabId("page");
//		dwzResult.setRel("page_sc1"); 
		dwzResult.setMessage("操作成功");  
		dwzResult.setStatusCode("200");  
//		dwzResult.setCallbackType("closeCurrent");  
//		dwzResult.setForwardUrl("customList.html?userName=aaa&deptCode=sc&actionType=listCustom");
		
		request.setAttribute("dwzResult", dwzResult);
	}
}
